package com.yonyou.isv.demo.openapi.api.taxrate;

import com.yonyou.isv.demo.openapi.base.module.reponse.ApiDataArrayResponse;
import com.yonyou.isv.demo.openapi.base.module.reponse.ApiDataResponse;
import com.yonyou.isv.demo.openapi.api.BaseOpenApi;
import com.yonyou.isv.demo.openapi.api.OpenApiURL;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @description: 用友开放平台接口税目税率
 * @author: zpp
 * @create: 2021-07-26
 **/
@Component
public class TaxRateApi extends BaseOpenApi {
    /**
     * 保存
     * @param params
     * @return
     */
    public Map<String,Object> save(Map<String,Object> params)
    {
        ApiDataResponse apiDataResponse = postForEntity(OpenApiURL.TAXRATE_SAVE, params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }

    /**
     * 按照id查询
     * @param params
     * @return
     */
    public Map<String,Object> findById(Map<String,String> params)
    {
        ApiDataResponse apiDataResponse = getForEntity(OpenApiURL.TAXRATE_ID, params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }
    /**
     * 按照code查询
     */
    public Map<String,Object> findByCode(Map<String,String> params)
    {
        ApiDataResponse apiDataResponse = getForEntity(OpenApiURL.TAXRATE_CODE, params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }
    /**
     * 按照税率值查询
     */
    public List<Map<String,Object>> findByTaxRate(Map<String,String> params)
    {
        ApiDataArrayResponse apiDataResponse = getForEntity(OpenApiURL.TAXRATE_NTAXRATE, params, ApiDataArrayResponse.class);
        return getData(apiDataResponse);
    }
    /**
     * 列表查询
     */
    public Map<String,Object> list(Map<String,Object> params)
    {
        ApiDataResponse apiDataResponse = postForEntity(OpenApiURL.TAXRATE_LIST, params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }
    /**
     *根据时间查询
     */
    public List<Map<String,Object>> findByTime(Map<String,String> params)
    {
        ApiDataArrayResponse apiDataResponse = getForEntity(OpenApiURL.TAXRATE_FINDBYTIME, params, ApiDataArrayResponse.class);
        return getData(apiDataResponse);
    }
    /**
     * 删除税目税率
     */
    public Map<String,Object> delete(Map<String,Object> params)
    {
        ApiDataResponse apiDataResponse = postForEntity(OpenApiURL.TAXRATE_DELETE, params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }
}
